package com.ruimei.service.impl;

import com.ruimei.entitys.Temp;
import com.ruimei.mapper.TempMapper;
import com.ruimei.service.TempService;
import com.ruimei.vo.TempVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TempServiceImpl implements TempService {

    @Resource
    TempMapper mapper;

    @Override
    public Map<String, Object> addTemp(Temp temp) {
        Map<String, Object> map = new HashMap();
        Integer i = mapper.addTemp(temp);
        if(i.intValue() == 1){
            map.put("status", Boolean.valueOf(true));
            map.put("message", "添加成功");
        }else{
            map.put("status", Boolean.valueOf(false));
            map.put("message", "添加失败");
        }

        return map;
    }

    @Override
    public Map<String, Object> getTempP(String studentId) {
        Map<String, Object> map = new HashMap();
        List<Temp> list = mapper.getTemp(studentId,null,null,null,null,null);

        map.put("status", Boolean.valueOf(true));
        map.put("message", "查询成功");
        map.put("count", Integer.valueOf(list.size()));
        map.put("data", list);

        return map;

    }

    @Override
    public Map<String, Object> getTempT(TempVo tempVo) {
        Map<String, Object> map = new HashMap();
        System.out.println(tempVo.toString());

        List<Temp> list = mapper.getTemp(tempVo.getStudentId(),tempVo.getClassId(),tempVo.getStudentName(),tempVo.getTemp(),tempVo.getEndTime(),tempVo.getBeginTime());

        map.put("status", Boolean.valueOf(true));
        map.put("message", "查询成功");
        map.put("count", Integer.valueOf(list.size()));
        map.put("data", list);

        return map;

    }




}
